package com.mxpio.erp.common.equipment.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.mxpioframework.security.annotation.Dict;
import com.mxpioframework.security.entity.BaseEntity;
import com.mxpioframework.security.entity.Dept;
import com.mxpioframework.security.entity.User;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import java.util.Date;

@Data
@EqualsAndHashCode(callSuper=false)
@Entity
@Table(name = "MB_ERP_EQUIPMENT_PROJECT_MANAGEMENT")
@Schema(description="项目列表")
public class ProjectManagement extends BaseEntity {

    private static final long serialVersionUID=1L;

    @Id
    @Column(name = "PRO_CODE_", updatable = false)
    @Schema(description = "项目编码")
    private String proCode;

    @Column(name = "PRO_NAME_")
    @Schema(description = "项目名称")
    private String proName;

    @Column(name = "PRO_TYPE_ID_")
    @Schema(description = "项目类型")
    @Dict(dicCode ="ERP_EQUIPMENT_PROJECT_TYPE")
    private String proTypeId;

    @Column(name = "TARGET_ID_")
    @Schema(description = "资产编码")
    private String targetId;

    @Column(name = "EQP_CODE_")
    @Schema(description = "设备编码")
    private String eqpCode;

    @Column(name = "EQP_NAME_")
    @Schema(description = "设备名称")
    private String eqpName;

    @Column(name = "EQP_TYPE_ID_")
    @Schema(description = "设备分类")
    @Dict(dicCode = "code", dicEntity = EquipmentCategory.class, dicText = "name")
    private String eqpTypeId;

    @Column(name = "USE_DEPT_ID_")
    @Schema(description = "使用单位")
    @Dict(dicCode = "deptCode", dicEntity = Dept.class, dicText = "deptName")
    private String useDeptId;

    @Column(name = "PRO_USER_ID_")
    @Schema(description = "负责人")
    @Dict(dicCode = "username", dicEntity = User.class, dicText = "nickname")
    private String proUserId;

    @Column(name = "PRO_TARGET_")
    @Schema(description = "项目目标")
    private String proTarget;

    @Column(name = "PRO_CONTENT_")
    @Schema(description = "项目内容简述")
    private String proContent;

    @Column(name = "PLAN_START_TIME_")
    @Schema(description = "计划开始时间")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date planStartTime;

    @Column(name = "DURATION_")
    @Schema(description = "工期")
    private Integer duration;

    @Column(name = "PLAN_END_TIME_")
    @Schema(description = "技术结束时间")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date planEndTime;

    @Column(name = "SCHEDULE_")
    @Schema(description = "进度")
    private Integer schedule = 0;

    @Column(name = "REALY_START_TIME_")
    @Schema(description = "实际开始时间")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date realyStartTime;

    @Column(name = "REALT_END_TIME_")
    @Schema(description = "实际结束时间")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date realyEndTime;

    @Column(name = "PRO_STATUS_")
    @Schema(description = "执行状态")
    @Dict(dicCode = "MB_ERP_EQUIPMENT_CALIBRATION_STATUS")
    private String proStatus = "10";

    @Column(name = "CREATE_BY_")
    @Schema(description = "创建人")
    @Dict(dicCode = "username", dicEntity = User.class, dicText = "nickname")
    private String createBy;

    @Column(name = "CREATE_DATE_")
    @Schema(description = "创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date createDate;

    @Column(name = "PRO_DESC_")
    @Schema(description = "备注")
    private String proDesc;

    @Column(name = "OPERATION_")
    @Schema(description = "操作")
    private String operation;

    @Column(name = "DEMAND_DEP_")
    @Schema(description = "需求部门")
    private String demandDep;

    @Column(name = "APPLY_DEP_")
    @Schema(description = "申请部门")
    private String applyDep;

    @Column(name = "APPLY_USER_")
    @Schema(description = "申请人")
    private String applyUser;
}
